/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vista;

import controlador.Conecion;
import controlador.Reporte;
import controlador.Utilidades;
import controlador.servicios.ServicioCuotaCobrarPagar;
import controlador.servicios.ServicioDetalleVenta;
import controlador.servicios.ServicioLoteProducto;
import controlador.servicios.ServicioPersona;

import controlador.servicios.ServicioServicios;
import controlador.servicios.ServicioVenta;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.swing.JOptionPane;
import vista.modeloTablas.ModeloTablaCuotas;
import vista.modeloTablas.ModeloTablaDeatalle;
import vista.modeloTablas.ModeloTablaLote;
import vista.modeloTablas.ModeloTablaProducto;
import vista.modeloTablas.ModeloTablaServicio;
import vista.utilidades.FacadeComponentes;

/**
 *
 * @author Alex
 */
public class PanelVenta extends javax.swing.JPanel {

    /**
     * Creates new form PanelVenta
     */
    private ModeloTablaLote modeloLote = new ModeloTablaLote();
    private ModeloTablaServicio modeloServicio = new ModeloTablaServicio();
    private ModeloTablaDeatalle modelo = new ModeloTablaDeatalle();
    private ServicioPersona sp = new ServicioPersona();
    private ServicioVenta sv = new ServicioVenta();
    private ServicioLoteProducto spr = new ServicioLoteProducto();
    private ServicioServicios ss = new ServicioServicios();
    private ModeloTablaCuotas modeloCuotas = new ModeloTablaCuotas();
    public PanelVenta() {
        initComponents();
        cargarTablaDetalle();
        //cargarTablaProducto();
        cargarModelosTabla();
    }

    private void cargarTablaProducto() {
        modeloLote.setLista(spr.listar());
        tablaProductos.setModel(modeloLote);
        tablaProductos.updateUI();
    }

    private void cargarTablaServicio() {
        modeloServicio.setLista(ss.listar());
        tablaProductos.setModel(modeloServicio);
        tablaProductos.updateUI();
    }

    private void cargarTablaDetalle() {
        tablaFactura.setModel(modelo);
        tablaFactura.updateUI();
        tbl_tablaCuotas.setModel(modeloCuotas);
        tbl_tablaCuotas.updateUI();
    }

    private void buscarPersona() {
        System.out.println(txtCedulaCliente.getText());
        sp.fijarInstancia(sp.obtenerPersonaCedula(txtCedulaCliente.getText()));
        if (sp.getPersona().getId_persona() != null) {
            txtApellidosCliente.setText(sp.getPersona().getApellidos_per());
            txtNombresCliente.setText(sp.getPersona().getNombres_per());
            txtDirecciónCliente.setText(sp.getPersona().getDireccion_per());
            txtTelfCellCliente.setText(sp.getPersona().getFono_per());
        } else {
            JOptionPane.showMessageDialog(this, "No se ha encontrado ningun cliente con esta cédula", "Error", JOptionPane.ERROR_MESSAGE);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtCedulaCliente = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtNombresCliente = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtApellidosCliente = new javax.swing.JTextField();
        btnBuscarCliente = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        txtTelfCellCliente = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtDirecciónCliente = new javax.swing.JTextField();
        btnNuevoCliente = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        cbmCategoriaBusquedaProd = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        txtCriterioBusqueda = new javax.swing.JTextField();
        btnBuscarProducto = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tablaProductos = new javax.swing.JTable();
        btnAgregarItem = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        txtFechaFactura = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtNumeroFactura = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tablaFactura = new javax.swing.JTable();
        btnEliminarItem = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        txtSubtotal = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        txtIva = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        txtTotal = new javax.swing.JTextField();
        btnNuevaFactura = new javax.swing.JButton();
        btnImprimirFactura = new javax.swing.JButton();
        btnCancelarB = new javax.swing.JButton();
        cbx_tipo = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        txt_abono = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        cbx_nro = new javax.swing.JComboBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        tbl_tablaCuotas = new javax.swing.JTable();

        setBorder(javax.swing.BorderFactory.createTitledBorder("SISTEMA DE FACTURACIÓN CELLTEC"));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del Cliente"));

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText("Nro. Cédula  /  RUC:");

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Ingrese los Nombres:");

        txtNombresCliente.setEnabled(false);

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText("Ingrese los Apellidos:");

        txtApellidosCliente.setEnabled(false);
        txtApellidosCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtApellidosClienteActionPerformed(evt);
            }
        });

        btnBuscarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/search.png"))); // NOI18N
        btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarClienteActionPerformed(evt);
            }
        });

        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel5.setText("Teléfono Celular:");

        txtTelfCellCliente.setEnabled(false);

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel6.setText("Dirección: ");

        txtDirecciónCliente.setEnabled(false);

        btnNuevoCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/add-item.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jLabel5))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(txtCedulaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtNombresCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtTelfCellCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtApellidosCliente)
                            .addComponent(txtDirecciónCliente))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(txtCedulaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnBuscarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtNombresCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jLabel3)
                        .addComponent(txtApellidosCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDirecciónCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtTelfCellCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel6))
                            .addComponent(jLabel5))
                        .addContainerGap())))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Productos"));

        jLabel7.setText("Buscar por:");

        cbmCategoriaBusquedaProd.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Producto", "Servicio" }));
        cbmCategoriaBusquedaProd.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbmCategoriaBusquedaProdItemStateChanged(evt);
            }
        });

        jLabel8.setText("Ingrese Campo: ");

        btnBuscarProducto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/search.png"))); // NOI18N
        btnBuscarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarProductoActionPerformed(evt);
            }
        });

        jPanel4.setLayout(new java.awt.BorderLayout());

        tablaProductos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tablaProductos);

        jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        btnAgregarItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/download.png"))); // NOI18N
        btnAgregarItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarItemActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAgregarItem, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(cbmCategoriaBusquedaProd, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtCriterioBusqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscarProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnAgregarItem))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel7)
                                    .addComponent(cbmCategoriaBusquedaProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel8)
                                    .addComponent(txtCriterioBusqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(btnBuscarProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)))
                .addContainerGap())
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("FACTURA"));

        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Fecha: ");

        txtFechaFactura.setEnabled(false);

        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel10.setText("NRO. FACTURA: ");

        txtNumeroFactura.setEditable(false);
        txtNumeroFactura.setFont(new java.awt.Font("Tahoma", 2, 18)); // NOI18N
        txtNumeroFactura.setForeground(new java.awt.Color(204, 0, 0));
        txtNumeroFactura.setEnabled(false);

        jPanel5.setLayout(new java.awt.BorderLayout());

        tablaFactura.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(tablaFactura);

        jPanel5.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        btnEliminarItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/delete-item.png"))); // NOI18N
        btnEliminarItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarItemActionPerformed(evt);
            }
        });

        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel11.setText("SUBTOTAL:");

        txtSubtotal.setEnabled(false);

        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("IVA:");

        txtIva.setEnabled(false);

        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("TOTAL:");

        txtTotal.setEnabled(false);

        btnNuevaFactura.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/add-item.png"))); // NOI18N
        btnNuevaFactura.setText("Nuevo");
        btnNuevaFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevaFacturaActionPerformed(evt);
            }
        });

        btnImprimirFactura.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/print.png"))); // NOI18N
        btnImprimirFactura.setText("Imprimir");
        btnImprimirFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImprimirFacturaActionPerformed(evt);
            }
        });

        btnCancelarB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/images/reload.png"))); // NOI18N
        btnCancelarB.setText("Cancelar");

        cbx_tipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Contado", "Credito" }));
        cbx_tipo.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbx_tipoItemStateChanged(evt);
            }
        });

        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel14.setText("TIPO DE PAGO");

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("CUOTAS"));
        jPanel6.setLayout(null);

        jLabel4.setText("Abono:");
        jPanel6.add(jLabel4);
        jLabel4.setBounds(18, 35, 48, 16);

        txt_abono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txt_abonoKeyReleased(evt);
            }
        });
        jPanel6.add(txt_abono);
        txt_abono.setBounds(84, 30, 101, 26);

        jLabel15.setText("Nro Cuotas:");
        jPanel6.add(jLabel15);
        jLabel15.setBounds(197, 35, 81, 16);

        cbx_nro.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5" }));
        cbx_nro.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbx_nroItemStateChanged(evt);
            }
        });
        jPanel6.add(cbx_nro);
        cbx_nro.setBounds(296, 30, 46, 26);

        tbl_tablaCuotas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane3.setViewportView(tbl_tablaCuotas);

        jPanel6.add(jScrollPane3);
        jScrollPane3.setBounds(30, 70, 452, 90);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtFechaFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNumeroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbx_tipo, 0, 121, Short.MAX_VALUE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(btnNuevaFactura, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                            .addComponent(btnImprimirFactura, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                            .addComponent(btnCancelarB, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtSubtotal)
                            .addComponent(txtIva)
                            .addComponent(txtTotal, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnEliminarItem, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(31, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(txtFechaFactura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(txtNumeroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbx_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnEliminarItem)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel11))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(0, 19, Short.MAX_VALUE)
                                .addComponent(btnNuevaFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel12)
                                    .addComponent(txtIva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnImprimirFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel13)
                                    .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnCancelarB, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(40, 40, 40))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void txtApellidosClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtApellidosClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtApellidosClienteActionPerformed

    private void btnBuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarClienteActionPerformed
        // TODO add your handling code here:
        buscarPersona();
    }//GEN-LAST:event_btnBuscarClienteActionPerformed

    private void cbmCategoriaBusquedaProdItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbmCategoriaBusquedaProdItemStateChanged
        // TODO add your handling code here:
        cargarModelosTabla();
        tablaFactura.clearSelection();
    }//GEN-LAST:event_cbmCategoriaBusquedaProdItemStateChanged

    private void btnBuscarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarProductoActionPerformed
        // TODO add your handling code here:
        buscar();
    }//GEN-LAST:event_btnBuscarProductoActionPerformed

    private void btnAgregarItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarItemActionPerformed
        // TODO add your handling code here:
        cargarProductoServicio();
        sumar();
    }//GEN-LAST:event_btnAgregarItemActionPerformed

    private void btnEliminarItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarItemActionPerformed
        // TODO add your handling code here:
        int fila = tablaFactura.getSelectedRow();
        if(fila>=0){
            FacadeComponentes.borrarProducto(modelo.getLista(), fila, modeloLote.getLista(), modeloServicio.getLista());
            tablaFactura.updateUI();
            tablaProductos.updateUI();
        }else{
            JOptionPane.showMessageDialog(this, "Escoja un detalle", "Error", JOptionPane.ERROR_MESSAGE);
        }
        sumar();
        tablaFactura.clearSelection();
    }//GEN-LAST:event_btnEliminarItemActionPerformed

    private void btnNuevaFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevaFacturaActionPerformed
        // TODO add your handling code here:
        limpiarCampos();
    }//GEN-LAST:event_btnNuevaFacturaActionPerformed

    private void btnImprimirFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirFacturaActionPerformed
        // TODO add your handling code here:
        String aux = (modelo.getLista().isEmpty())?"":"hay";
        if(Utilidades.requerido(txtApellidosCliente,txtApellidosCliente.getText())==true&&
                Utilidades.requerido(tablaFactura,aux)==true&&
                Utilidades.requerido(txtTotal,txtTotal.getText())==true){
            cargarObjeto();
            if(sv.guardar()==true){
                FacadeComponentes.actualizarStockLote(modelo.getLista());
                JOptionPane.showMessageDialog(this, "Se ha guardado su factura", "Error", JOptionPane.INFORMATION_MESSAGE);
                enviarDatosReporte(sv);
                limpiarCampos();
                
            }else{
                JOptionPane.showMessageDialog(this, "No se pudo guardar", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_btnImprimirFacturaActionPerformed

    private void cbx_tipoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbx_tipoItemStateChanged
        // TODO add your handling code here:
        if(cbx_tipo.getSelectedItem().toString().equalsIgnoreCase("contado")){
            bloquear();
        }else{
            crearCuentasTablas();
        }
        
    }//GEN-LAST:event_cbx_tipoItemStateChanged

    private void txt_abonoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_abonoKeyReleased
        // TODO add your handling code here:
        crearCuentasTablas();
    }//GEN-LAST:event_txt_abonoKeyReleased

    private void cbx_nroItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbx_nroItemStateChanged
        // TODO add your handling code here:
        crearCuentasTablas();
    }//GEN-LAST:event_cbx_nroItemStateChanged
    private void cargarProductoServicio(){
        int fila = tablaProductos.getSelectedRow();
        boolean ver = true;
        int pos = -1;
        ServicioDetalleVenta saux = new ServicioDetalleVenta();
        if(fila>=0){
            if (cbmCategoriaBusquedaProd.getSelectedIndex() == 0) {
                List<Object> lista = FacadeComponentes.existeProducto(modelo.getLista(), modeloLote.getLista().get(fila), null);
                ver = (boolean)lista.get(0);
                pos = (int)lista.get(1);
                System.out.println("d1 "+ver+" -- "+pos);
                saux.fijarInstancia(FacadeComponentes.llenarDetalle(null, modeloLote.getLista().get(fila), sv.getVenta(), modelo.getLista(), ver));
                //true existe
                
            } else {
                List<Object> lista = FacadeComponentes.existeProducto(modelo.getLista(), null, modeloServicio.getLista().get(fila));
                ver = (boolean)lista.get(0);
                pos = (int)lista.get(1);
                System.out.println("d2 "+ver+" -- "+pos);
                saux.fijarInstancia(FacadeComponentes.llenarDetalle(modeloServicio.getLista().get(fila), null, sv.getVenta(), modelo.getLista(), ver));
                
            }
            if(ver==false){
                    modelo.getLista().add(saux.getDetalleVenta());
                }else{
                    modelo.getLista().remove(pos);
                    modelo.getLista().add(saux.getDetalleVenta());
                }
            tablaFactura.updateUI();
            tablaProductos.updateUI();
        }else{
            JOptionPane.showMessageDialog(this, "Escoja un producto o servicio de la tabla", "Error", JOptionPane.ERROR_MESSAGE);
        }
        
    }
    private void cargarModelosTabla() {
        txtFechaFactura.setText(Utilidades.formatoFechaDateString(new Date()));
        txtNumeroFactura.setText("000000"+(sv.listar().size()+1));
        if (cbmCategoriaBusquedaProd.getSelectedIndex() == 0) {
            cargarTablaProducto();
            txtCriterioBusqueda.setToolTipText("Ingrese el tipo o la marca del producto o por su código de barras");
        } else {
            cargarTablaServicio();
            txtCriterioBusqueda.setToolTipText("Ingrese el nombre del servicio");
        }
    }
    private void buscar(){
        if (cbmCategoriaBusquedaProd.getSelectedIndex() == 0) {
            modeloLote.setLista(spr.buscarLike(txtCriterioBusqueda.getText()));
            tablaProductos.setModel(modeloLote);
            tablaProductos.updateUI();
        } else {
            modeloServicio.setLista(ss.buscar(" p.nombre_serv", txtCriterioBusqueda.getText()));
            tablaProductos.setModel(modeloServicio);
            tablaProductos.updateUI();
        }
        tablaFactura.clearSelection();
    }
    private void sumar(){
        List<Double>lista = FacadeComponentes.sumarDatosTabla(modelo.getLista());
        txtSubtotal.setText(String.valueOf(lista.get(0)));
        txtIva.setText(String.valueOf(lista.get(1)));
        txtTotal.setText(String.valueOf(lista.get(2)));
    }
    private void cargarObjeto(){
        sv.getVenta().setCliente(sp.getPersona());
        sv.getVenta().setFecha_venta(new Date());
        sv.getVenta().setIva(Double.parseDouble(txtIva.getText()));
        sv.getVenta().setSubtotal(Double.parseDouble(txtSubtotal.getText()));
        sv.getVenta().setTotal(Double.parseDouble(txtSubtotal.getText()));
        sv.getVenta().setEstado("venta");
        sv.getVenta().setListaDetalle(modelo.getLista());
    }
    private void limpiarCampos(){
        txtSubtotal.setText("0");
        txtIva.setText("0");
        txtTotal.setText("0");
        cargarModelosTabla();
        modelo.getLista().clear();
        cargarTablaDetalle();
        sp.nuevaInstancia();
        spr.nuevaInstancia();
        ss.nuevaInstancia();
        sv.nuevaInstancia();
        txtApellidosCliente.setText("");
        txtCedulaCliente.setText("");
        txtCriterioBusqueda.setText("");
        txtDirecciónCliente.setText("");
        txtFechaFactura.setText("");
        cbmCategoriaBusquedaProd.setSelectedIndex(0);
        txtNombresCliente.setText("");
        txtDirecciónCliente.setText("");
    }
    private void enviarDatosReporte(ServicioVenta sva){
        HashMap parametros = new HashMap();
            parametros.put("nro_fact", sva.getVenta().getNro_venta());
            parametros.put("fecha", Utilidades.formatoFechaDateString(sva.getVenta().getFecha_venta()));
            parametros.put("cedula", sva.getVenta().getCliente().getCedula_per());
            parametros.put("cliente", sva.getVenta().getCliente().toString());
            parametros.put("direccion", sva.getVenta().getCliente().getDireccion_per());
            parametros.put("fono", sva.getVenta().getCliente().getFono_per());
            parametros.put("subtotal", sva.getVenta().getSubtotal());
            parametros.put("iva", sva.getVenta().getIva());
            parametros.put("descuento", 0.0);
            parametros.put("total", (sva.getVenta().getTotal()));
            new Reporte().crearReporte("factura", sva.getVenta().getListaDetalle(), "factura.pdf", parametros);
    }
    
    private void crearCuentasTablas(){
        modeloCuotas.getLista().clear();
        String tipo = cbx_tipo.getSelectedItem().toString();
        if(!tipo.equalsIgnoreCase("contado")){
            double total = 0;
            try {
                total = Double.parseDouble(txtTotal.getText());
            } catch (Exception e) {
            }
            double abono = 0;
            try {
                abono = Double.parseDouble(txt_abono.getText());
            } catch (Exception e) {
            }
            double saldo = total - abono;
            int nro = Integer.parseInt(cbx_nro.getSelectedItem().toString());
            ServicioCuotaCobrarPagar sccp = new ServicioCuotaCobrarPagar();
            sccp.getCuota().setAbono(abono);
            sccp.getCuota().setSaldo_actual(saldo);
            sccp.getCuota().setNro_cuotas(nro);
            sccp.getCuota().setTipo("venta");
            sccp.getCuota().setVenta(this.sv.getVenta());
            this.sv.getVenta().setCuentapc(sccp.getCuota());
            
            modeloCuotas.setLista(FacadeComponentes.crearCuotas(saldo, nro, sccp.getCuota(), tipo));
            tbl_tablaCuotas.updateUI();
        }else{
            bloquear();
        }
    }
    
    private void bloquear(){
        txt_abono.setText("0.0");
        cbx_nro.setSelectedIndex(0);
        modeloCuotas.getLista().clear();
        tbl_tablaCuotas.updateUI();
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAgregarItem;
    private javax.swing.JButton btnBuscarCliente;
    private javax.swing.JButton btnBuscarProducto;
    private javax.swing.JButton btnCancelarB;
    private javax.swing.JButton btnEliminarItem;
    private javax.swing.JButton btnImprimirFactura;
    private javax.swing.JButton btnNuevaFactura;
    private javax.swing.JButton btnNuevoCliente;
    private javax.swing.JComboBox cbmCategoriaBusquedaProd;
    private javax.swing.JComboBox cbx_nro;
    private javax.swing.JComboBox cbx_tipo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable tablaFactura;
    private javax.swing.JTable tablaProductos;
    private javax.swing.JTable tbl_tablaCuotas;
    private javax.swing.JTextField txtApellidosCliente;
    private javax.swing.JTextField txtCedulaCliente;
    private javax.swing.JTextField txtCriterioBusqueda;
    private javax.swing.JTextField txtDirecciónCliente;
    private javax.swing.JTextField txtFechaFactura;
    private javax.swing.JTextField txtIva;
    private javax.swing.JTextField txtNombresCliente;
    private javax.swing.JTextField txtNumeroFactura;
    private javax.swing.JTextField txtSubtotal;
    private javax.swing.JTextField txtTelfCellCliente;
    private javax.swing.JTextField txtTotal;
    private javax.swing.JTextField txt_abono;
    // End of variables declaration//GEN-END:variables
}
